<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/admin/basic.css" type="text/css"/>
<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/admin/index.css" type="text/css"/>
<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/admin/table1.css" type="text/css"/>
<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/icon.css" type="text/css"/>
<link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/bootstrap.css" type="text/css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/main.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/admin/jquery.adminnew.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/bootstrap.js"></script>
<script type="text/javascript">
$(function(){
	$("#admintable").admintable();
});

function display(){
    document.getElementById("mainForm").action="search";
    document.getElementById("mainForm").submit();
}
</script>
</head>
<body>
<div class="main_content_container">
    <form method="post" id="mainForm">
	<table id="admintable" cellpadding="0" cellspacing="0">
        <thead>
        <tr>
            <td  colspan="9" class="title">
                <ul class="function_menu">
                    <li id="select"> <input name="orderId" size="30"/> </li>
                    <li><a href="#" onclick="display()"><span class="icon16 icon-search"></span>查询</a></li>

                </ul>
            </td>
        </tr>
        </thead>
        <tr showCheck="1">
            <td objId="1" width="5%" align="center"><strong>订单编号</strong></td>
            <td width="6%" align="center"><strong>商家ID</strong></td>
            <td width="6%" align="center"><strong>买家ID</strong></td>
            <td width="39%" align="center"><strong>订单地址</strong></td>
            <td width="8%" align="center"><strong>订单价格</strong></td>
            <td width="15%" align="center"><strong>下单时间</strong></td>
            <td width="10%" align="center"><strong>订单状态</strong></td>
            <td width="8%" align="center"><strong>用户操作</strong></td>
        </tr>
        </thead>

	<tbody>


    <c:forEach items="${orderList.datas }" var="order">
        <tr>
            <td objId="${order.id}" align="center">${order.id}</td>
            <td align="center"><a href="${order.seller_id }" class="list_link">${order.seller_id }</a></td>
            <td align="center"><a href="${order.user_id }" class="list_link">${order.user_id }</a></td>
            <td align="center" align="center">
               ${order.address.address }
            </td>
            <td objId="${order.total}" align="center">${order.total}</td>
            <td objId="${order.orderdate}" align="center">${order.orderdate}</td>
            <td objId="${order.state}" align="center">${order.state}</td>
            <td align="center">
                <a href="${order.id }/delete" title="${order.id }" class="name"  oper="delete">删除</a>

                <c:choose>
                    <c:when test="${order.state eq '退款中...' }">
                        <a href="${order.id }/update" title="${order.id }" class="name" >修改</a>
                    </c:when>
                    <c:when test="${order.state eq '待付款' }">
                        <a href="${order.id }/update" title="${order.id }" class="name" >修改</a>
                    </c:when>
                    <c:when test="${order.state eq '待发货'}">
                        <a href="${order.id }/update" title="${order.id }" class="name" >修改</a>
                    </c:when>
                </c:choose>
                <a title="${order.id }" data-toggle="collapse"
                   href="#${order.id }" aria-expanded="false" aria-controls="collapseExample">查看详情</a>
            </td>

        </tr>
        <tr>
            <td colspan="8">
              <div class="panel-collapse collapse" id="${order.id }" style="background-color: #7D97A3">
                  <table class="table">
                          <tr>
                              <td width="10%" align="center">商品ID</td>
                              <td width="20%" align="center">商品名字</td>
                              <td width="20%" align="center">商品属性</td>
                              <td width="20%" align="center">商品单价</td>
                              <td width="10%" align="center">商品数量</td>
                              <td width="20%" align="center">小计</td>

                          </tr>
                      <c:forEach items="${order.orderItems}" var="item">
                          <tr>
                              <td width="10%" align="center">${item.goods.id}</td>
                              <td width="20%" align="center">${item.goods.name}</td>
                              <td width="20%" align="center">brand:${item.goods.brand}<br>CPU:${item.goods.CPU}<br>RAM:${item.goods.RAM}</td>
                              <td width="20%" align="center">${item.goods.price}</td>
                              <td width="10%" align="center">${item.quantity}</td>
                              <td width="20%" align="center">${item.subtotal}</td>
                          </tr>
                      </c:forEach>
                  </table>
              </div>
            </td>
        </tr>
    </c:forEach>
	  	</tbody>

	  	<tfoot>
	  	<tr>
		    <td colspan="9">
                <jsp:include page="/jsp/public/pager.jsp">
                    <jsp:param value="${orderList.total }" name="totalRecord"/>
                    <jsp:param value="orderList" name="url"/>
                </jsp:include>
		    </td>
	    </tr>
	    </tfoot>

	</table>
    </form>
   </div>
</div>
</body>
</html>